From 9a06b0fd5f6e992027f09623c4d72a803b9bfd23 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 17 Nov 2016 23:16:14 +0100 Subject: [PATCH] widget: Fix math screwups in clip calculation We need so subtract the allocation from the clip to get the clip offset, not the other way around. This was screwing in particular with marks on GtkScale, because GtkScale mark clip computation is broken and always returns (0,0) which makes scales have a waaaaay too large clip. But that's another bug. --- gtk/gtkwidget.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 4045e3f501..c45f9a39eb 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -6413,13 +6413,13 @@ gtk_widget_draw_internal (GtkWidget *widget, GskRenderNode *node; graphene_rect_init (&viewport, - widget->priv->allocation.x - widget->priv->clip.x, - widget->priv->allocation.y - widget->priv->clip.y, + widget->priv->clip.x - widget->priv->allocation.x, + widget->priv->clip.y - widget->priv->allocation.y, widget->priv->clip.width, widget->priv->clip.height); clip = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { - widget->priv->allocation.x - widget->priv->clip.x, - widget->priv->allocation.y - widget->priv->clip.y, + widget->priv->clip.x - widget->priv->allocation.x, + widget->priv->clip.y - widget->priv->allocation.y, widget->priv->clip.width, widget->priv->clip.height}); fallback = gsk_renderer_create_fallback (renderer, &viewport, cr); @@ -15656,7 +15656,7 @@ gtk_widget_snapshot (GtkWidget *widget, gtk_widget_get_clip (widget, &clip); _gtk_widget_get_allocation (widget, &alloc); - graphene_rect_init (&bounds, alloc.x - clip.x, alloc.y - clip.y, clip.width, clip.height); + graphene_rect_init (&bounds, clip.x - alloc.x, clip.y - alloc.y, clip.width, clip.height); if (gtk_snapshot_clips_rect (snapshot, &bounds)) return; -- 2.30.2